package com.qianfeng.smartmeeting.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qianfeng.smartmeeting.entity.Booking;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

@Mapper
public interface BookingMapper extends BaseMapper<Booking> {
    
    @Select("SELECT * FROM booking WHERE room_id = #{roomId} AND slot_id = #{slotId} " +
            "AND booking_date = #{bookingDate} AND status IN (0, 1)")
    List<Booking> findConflictBookings(@Param("roomId") Long roomId, 
                                     @Param("slotId") Long slotId,
                                     @Param("bookingDate") Date bookingDate);
}